﻿@model IEnumerable<GSLMS.Entity.TB_LOAN_CONTRACT>
@{
    Layout = null;
    ViewBag.ViewTitle = "合同信息";
    int i = 1;
    var SearchParma = ViewData["SearchParma"] as GSLMS.Entity.TB_LOAN_CONTRACT ?? new GSLMS.Entity.TB_LOAN_CONTRACT();
    
    var systemIDList = ViewData["systemIDList"] as SelectList;
    var bussTypeList = ViewData["bussTypeList"] as SelectList;
}
<form id="pagerForm" method="get" action="Contract/ConAgr/index?action=page&OpID=@ViewData["OperateID"]">
<input type="hidden" name="pageNum" value="1" />
<input type="hidden" name="numPerPage" value="@ViewData["pageSize"]" />
<input type="hidden" name="RowCount" value="@ViewData["RowCount"]" />
<input type="hidden" name="CUSTNAME" value="@SearchParma.CUSTNAME" />
<input type="hidden" name="CONTRACTNO" value="@SearchParma.CONTRACTNO" />
<input type="hidden" name="APPLYID" value="@SearchParma.APPLYID" />
<input type="hidden" name="BUSSTYPE"" value="@SearchParma.BUSSTYPE" />
<input type="hidden" name="STATUS" value="0" />
<input type="hidden" name="STATUS2" value="0" />
<input type="hidden" name="SYSTEMID" value="@SearchParma.SYSTEMID" />
</form>
<div class="pageHeader">
    <form onsubmit="return navTabSearch(this)" id="Form_@ViewData["CurrentController"]" action="Contract/ConAgr/index?action=search&OpID=@ViewData["OperateID"]"
    method="post">
    <div class="searchBar">
        <table class="searchContent">
            <tr>
                <td>
                    客户名称：
                </td>
                <td>
                    @Html.TextBox("CUSTNAME", SearchParma.CUSTNAME, new { @style = "width:100px;" })
                </td>
                <td>
                    主合同编号/当票号：
                </td>
                <td>
                     @Html.TextBox("CONTRACTNO", SearchParma.CONTRACTNO, new { @style = "width:100px;" })
                </td>
                <td>
                    申请编号：
                </td>
                <td style="text-align:left;">
                    @Html.TextBox("APPLYID", SearchParma.APPLYID, new { @style = "width:100px;" })
                </td>
            </tr>
            <tr>
                <td>
                    业务类型：
                </td>
                <td>
                    @Html.DropDownList("BUSSTYPE", bussTypeList, GSLMS.WebAPP.HelperCommon.SelectDefaultValue, new { @class = "", @style = "width:80px;" })
                </td>
                <td>
                    合同状态：
                </td>
                <td>
                   <input type="checkbox" name="STATUS" value="1" @(SearchParma.STATUS == 1 ? "checked='checked'" : "")  /><span>未签订合同
                    </span>
                     <input type="checkbox" name="STATUS2" value="1" @(SearchParma.STATUS2 == 1 ? "checked='checked'" : "") />
                    <span>已签订合同
                </td>
               
                <td>
                    来源：
                </td>
                <td>
                    @Html.DropDownList("SYSTEMID", systemIDList, GSLMS.WebAPP.HelperCommon.SelectDefaultValue, new { @class = "", @style = "width:80px;" })
                </td>
                <td align="right">
                    <div class="subBar">
                        <ul>
                            <li>
                                <div class="buttonActive">
                                    <div class="buttonContent">
                                        <button type="submit" name="submit">
                                            检索</button></div>
                                </div>
                            </li>
                            <li>
                                <div class="buttonActive">
                                    <div class="buttonContent">
                                        <button type="reset" name="reset">
                                            重置</button></div>
                                </div>
                            </li>
                        </ul>
                    </div>
                </td>
            </tr>
        </table>
    </div>
    </form>
</div>
<div class="pageContent">
    @Html.Partial("Buttons")
    <table class="list" layouth="127" id="tableContractList">
        <thead>
            <tr class="header">
                <th style="width:60px;">
                    来源
                </th>
                <th style="width:135px;">
                    主合同编号/当票号
                </th>
                <th style="width:100px;">
                    客户名称
                </th>
                <th style="width:120px;">
                    确认批核金额(万元)
                </th>
                <th style="width:80px;">
                    业务类型
                </th>
                <th style="width:80px;">
                    项目经理
                </th>
                <th style="width:80px;">
                    确认日期
                </th>
                <th style="width:80px;">
                    确认人
                </th>
                <th style="width:80px;">
                    合同状态
                </th>
                <th style="width:80px;">
                    放款状态
                </th>
            </tr>
        </thead>
        @foreach (var item in Model)
        {            
            <tr target="ContractList_id" rel="@item.PROID" BussType="@item.BUSSTYPE" Status="@item.STATUS">
                <td style="text-align:center;">
                    @((GSLMS.Entity.Enum.SystemEnum.SystemID)item.SYSTEMID)
                </td>
                <td>
                    @(item.CONTRACTNO == null ? item.TICKETNO : item.CONTRACTNO)
                </td>
                <td>
                    @item.CUSTNAME
                </td>
                <td style="text-align:right;">
                    @item.AUDITAMT
                </td>
               
                <td style="text-align:center;">
                   @((GSLMS.Entity.Enum.ApplyEnum.RegBussType)item.BUSSTYPE)
                </td>
                 <td style="text-align:right;">
                   
                </td>
                <td style="text-align:center;">
                   @item.CONFIRMBY
                </td>
                <td style="text-align:center;">
                    @item.CONFIRMDATE
                </td>
                <td style="text-align:center;">
                    @((GSLMS.Entity.Enum.ContractEnum.ContractStatus)item.STATUS)
                </td>
                <td style="text-align:center;">
                    @((GSLMS.Entity.Enum.ContractEnum.LoanStatus)item.LOANSTATUS)
                </td>
            </tr>
            i += 1;
        }
    </table>
</div>
@Html.Partial("PageBar")
<script>
    var GoPIR = function (obj) {
        $this = $(obj);
        var selectedObj = $("#tableApplyList").find(".selected");
        var id = selectedObj.attr("rel");
        if (id) {
            var bussType = selectedObj.attr("BussType");
            var status = selectedObj.attr("Status");
            if (status == 1) {
                if (bussType == 3) {
                    pdialogOpen($this, "DianDang/Apply/ProInfo/CreateHouInfo/0?OpID=DianDang_Apply_ApplyList_5&RegID=" + id, "赎楼申请");
                }
                else {
                    pdialogOpen($this, "DianDang/Apply/ProInfo/Create/0?OpID=DianDang_Apply_ApplyList_5&RegID=" + id, "立项申请");
                }
            }
            else {
                alertMsg.warn("状态必须是[跟进中]");
            }
        }
        else {
            alertMsg.warn("请选择一条记录!");
        }
        return false;
    }
    function pdialogOpen($this, url, title) {
        //var title = $this.attr("title") || $this.text();
        var rel = $this.attr("rel") || "_blank";
        var options = {};
        var w = $this.attr("width");
        var h = $this.attr("height");
        if (w) options.width = w;
        if (h) options.height = h;
        options.max = eval($this.attr("max") || "false");
        options.mask = eval($this.attr("mask") || "false");
        options.maxable = eval($this.attr("maxable") || "true");
        options.minable = eval($this.attr("minable") || "true");
        options.fresh = eval($this.attr("fresh") || "true");
        options.resizable = eval($this.attr("resizable") || "true");
        options.drawable = eval($this.attr("drawable") || "true");
        options.close = eval($this.attr("close") || "");
        options.param = $this.attr("param") || "";
        //var url = unescape($this.attr("href")).replaceTmById($(event.target).parents(".unitBox:first"));
        DWZ.debug(url);
        if (!url.isFinishedTm()) {
            alertMsg.error($this.attr("warn") || DWZ.msg("alertSelectMsg"));
            return false;
        }
        $.pdialog.open(url, rel, title, options);
    }
</script>
